import { createStore } from 'vuex'

const store = createStore({
  state: {
    
    isLoading: true,
    darkMode: false,
    nightLight: false,

    start_active: false,
    calendar_active: false,
    notificationCenter_active: false,

    focus: '',

    identify_active: false,
    identify_show: true,

    browser_active: false,
    browser_show: true,

    vscode_active: false,
    vscode_show: true,

    writeboard_active: false,
    writeboard_show: true,
    
    cloudmusic_active: false,
    cloudmusic_show: true,
  },
  mutations: {
  
    CHANGE_BOOTSCREEN (state) {
      state.isLoading = false
    },

    CHANGE_DARKMODE (state) {
      state.darkMode = !state.darkMode
    },

    CHANGE_NIGHTLIGHT (state) {
      state.nightLight = !state.nightLight
    },

    CHANGE_START (state) {
      state.start_active = !state.start_active
    },

    CHANGE_CALENDAR (state) {
      state.calendar_active = !state.calendar_active
    },

    CHANGE_NOTIFICATIONCENTER (state) {
      state.notificationCenter_active = !state.notificationCenter_active
    },

    CHANGE_FOCUS (state, app) {
      state.focus = app
    },

    CHANGE_IDENTIFY_ACTIVE (state, status) {
      state.identify_active = status
      store.commit('CHANGE_IDENTIFY_SHOW', true)
    },
    CHANGE_IDENTIFY_SHOW (state, status) {
      state.identify_show = status
      if(status) {
        store.commit('CHANGE_FOCUS', 'identify')
      }
    },

    CHANGE_BROWSER_ACTIVE (state, status) {
      state.browser_active = status
      store.commit('CHANGE_BROWSER_SHOW', true)
    },
    CHANGE_BROWSER_SHOW (state, status) {
      state.browser_show = status
      if(status) {
        store.commit('CHANGE_FOCUS', 'browser')
      }
    },

    CHANGE_VSCODE_ACTIVE (state, status) {
      state.vscode_active = status
      store.commit('CHANGE_VSCODE_SHOW', true)
    },
    CHANGE_VSCODE_SHOW (state, status) {
      state.vscode_show = status
      if(status) {
        store.commit('CHANGE_FOCUS', 'vscode')
      }
    },

    CHANGE_WRITEBOARD_ACTIVE (state, status) {
      state.writeboard_active = status
      store.commit('CHANGE_WRITEBOARD_SHOW', true)
    },
    CHANGE_WRITEBOARD_SHOW (state, status) {
      state.writeboard_show = status
      if(status) {
        store.commit('CHANGE_FOCUS', 'writeboard')
      }
    },
    
    CHANGE_CLOUDMUSIC_ACTIVE (state, status) {
      state.cloudmusic_active = status
      store.commit('CHANGE_CLOUDMUSIC_SHOW', true)
    },
    CHANGE_CLOUDMUSIC_SHOW (state, status) {
      state.cloudmusic_show = status
      if(status) {
        store.commit('CHANGE_FOCUS', 'cloudmusic')
      }
    },

  }
})

export {
    store
}